
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.1.3 一些核心概念 · Ebook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zq_sdk@163.com">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tree/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="koa_web.html" />
    
    
    <link rel="prev" href="async.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"TIME-GATE/","types":["star","watch"],"size":"large"};
    </script>

    
    <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chart/c3/c3.min.css">
    <script src="../../gitbook/gitbook-plugin-chart/c3/d3.min.js"></script>
    <script src="../../gitbook/gitbook-plugin-chart/c3/c3.min.js"></script>
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../../about_me.html">
            
                <a href="../../about_me.html">
            
                    
                    关于
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="../../gitbook_install.html">
            
                <a href="../../gitbook_install.html">
            
                    
                    附:Gitbook安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../">
            
                <a href="../../">
            
                    
                    一 基础理论
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../data_structure/">
            
                <a href="../../data_structure/">
            
                    
                    1 数据结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../../data_structure/11_linear_structure.html">
            
                <a href="../../data_structure/11_linear_structure.html">
            
                    
                    1.1 数组、链表、跳表及字典
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1.1" data-path="../../data_structure/111_array.html">
            
                <a href="../../data_structure/111_array.html">
            
                    
                    1.1.1 数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.2" data-path="../../data_structure/112_link_list.html">
            
                <a href="../../data_structure/112_link_list.html">
            
                    
                    1.1.2 链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.3" data-path="../../data_structure/113_skip_list.html">
            
                <a href="../../data_structure/113_skip_list.html">
            
                    
                    1.1.3 跳表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.4" data-path="../../data_structure/114_dictionary.html">
            
                <a href="../../data_structure/114_dictionary.html">
            
                    
                    1.1.4 字典
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../../data_structure/12_stack_and_queue.html">
            
                <a href="../../data_structure/12_stack_and_queue.html">
            
                    
                    1.2 栈、队列、散列及集合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.2.1" data-path="../../data_structure/121_stack.html">
            
                <a href="../../data_structure/121_stack.html">
            
                    
                    1.2.1 栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.2" data-path="../../data_structure/122_queue.html">
            
                <a href="../../data_structure/122_queue.html">
            
                    
                    1.2.2 队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.3" data-path="../../data_structure/123_hash.html">
            
                <a href="../../data_structure/123_hash.html">
            
                    
                    1.2.3 散列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.4" data-path="../../data_structure/124_set.html">
            
                <a href="../../data_structure/124_set.html">
            
                    
                    1.2.4 集合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../../data_structure/13_tree_and_forest.html">
            
                <a href="../../data_structure/13_tree_and_forest.html">
            
                    
                    1.3 树与森林
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.3.1" data-path="../../data_structure/131.html">
            
                <a href="../../data_structure/131.html">
            
                    
                    1.3.1 二叉搜索树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3.2" data-path="../../data_structure/132.html">
            
                <a href="../../data_structure/132.html">
            
                    
                    1.3.2 红黑树
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="../../data_structure/14_map.html">
            
                <a href="../../data_structure/14_map.html">
            
                    
                    1.4 图结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.4.1" data-path="../../data_structure/141_minimal_tree.html">
            
                <a href="../../data_structure/141_minimal_tree.html">
            
                    
                    1.4.1 最小生成树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.2" data-path="../../data_structure/142_single_source_shortest_path.html">
            
                <a href="../../data_structure/142_single_source_shortest_path.html">
            
                    
                    1.4.2 单源最短路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.3" data-path="../../data_structure/143_all_source_shortest_path.html">
            
                <a href="../../data_structure/143_all_source_shortest_path.html">
            
                    
                    1.4.3 多源最短路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.4" data-path="../../data_structure/144_max_stream.html">
            
                <a href="../../data_structure/144_max_stream.html">
            
                    
                    1.4.4 最大流
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../">
            
                <a href="../../">
            
                    
                    2 基础算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../../algorithm/21.html">
            
                <a href="../../algorithm/21.html">
            
                    
                    2.1 排序查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../../algorithm/22.html">
            
                <a href="../../algorithm/22.html">
            
                    
                    2.2 动态规划
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../algorithm/distributed_algorithm.html">
            
                <a href="../../algorithm/distributed_algorithm.html">
            
                    
                    3 分布式算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../../engineering/ci_deplopment/cs/theory.html">
            
                <a href="../../engineering/ci_deplopment/cs/theory.html">
            
                    
                    3.1 一致性模式与理论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../../algorithm/raft.html">
            
                <a href="../../algorithm/raft.html">
            
                    
                    3.2 Raft协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../../algorithm/paxos.html">
            
                <a href="../../algorithm/paxos.html">
            
                    
                    3.3 Paxos协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../../algorithm/gossip.html">
            
                <a href="../../algorithm/gossip.html">
            
                    
                    3.4 Gossip协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.5" data-path="../../engineering/ci_deplopment/cs/plan.html">
            
                <a href="../../engineering/ci_deplopment/cs/plan.html">
            
                    
                    3.5 几种一致性方案
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../optimization_se/">
            
                <a href="../../optimization_se/">
            
                    
                    4 运筹及系统工程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../../optimization_se/linear_programming.html">
            
                <a href="../../optimization_se/linear_programming.html">
            
                    
                    4.1 线性规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../../optimization_se/integer_programming.html">
            
                <a href="../../optimization_se/integer_programming.html">
            
                    
                    4.2 整数规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.3" data-path="../../optimization_se/目标规划.html">
            
                <a href="../../optimization_se/目标规划.html">
            
                    
                    4.3 目标规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.4" data-path="../../optimization_se/非线性规划.html">
            
                <a href="../../optimization_se/非线性规划.html">
            
                    
                    4.4 非线性规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.5" data-path="../../optimization_se/动态规划.html">
            
                <a href="../../optimization_se/动态规划.html">
            
                    
                    4.5 动态规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.6" data-path="../../optimization_se/排队论.html">
            
                <a href="../../optimization_se/排队论.html">
            
                    
                    4.6 排队论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.7" data-path="../../optimization_se/博弈论.html">
            
                <a href="../../optimization_se/博弈论.html">
            
                    
                    4.7 博弈论
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    二 工程应用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../engineering/design_pattern/">
            
                <a href="../../engineering/design_pattern/">
            
                    
                    1 设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../../engineering/design_pattern/strategy.html">
            
                <a href="../../engineering/design_pattern/strategy.html">
            
                    
                    1.1 策略模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../../engineering/design_pattern/prototype.html">
            
                <a href="../../engineering/design_pattern/prototype.html">
            
                    
                    1.2 原型模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.3" data-path="../../engineering/design_pattern/singleton.html">
            
                <a href="../../engineering/design_pattern/singleton.html">
            
                    
                    1.3 单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.4" data-path="../../engineering/design_pattern/factory.html">
            
                <a href="../../engineering/design_pattern/factory.html">
            
                    
                    1.4 工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.5" data-path="../../engineering/design_pattern/bridge.html">
            
                <a href="../../engineering/design_pattern/bridge.html">
            
                    
                    1.5 桥接模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.6" data-path="../../engineering/design_pattern/composite.html">
            
                <a href="../../engineering/design_pattern/composite.html">
            
                    
                    1.6 组合模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.7" data-path="../../engineering/design_pattern/facade.html">
            
                <a href="../../engineering/design_pattern/facade.html">
            
                    
                    1.7 门面模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.8" data-path="../../engineering/design_pattern/adapter.html">
            
                <a href="../../engineering/design_pattern/adapter.html">
            
                    
                    1.8 适配器模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.9" data-path="../../engineering/design_pattern/decorator.html">
            
                <a href="../../engineering/design_pattern/decorator.html">
            
                    
                    1.9 装饰者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.10" data-path="../../engineering/design_pattern/flyweight.html">
            
                <a href="../../engineering/design_pattern/flyweight.html">
            
                    
                    1.10 享元模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.11" data-path="../../engineering/design_pattern/proxy.html">
            
                <a href="../../engineering/design_pattern/proxy.html">
            
                    
                    1.11 代理模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.12" data-path="../../engineering/design_pattern/middleware.html">
            
                <a href="../../engineering/design_pattern/middleware.html">
            
                    
                    1.12 中间件模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../engineering/network_prag/">
            
                <a href="../../engineering/network_prag/">
            
                    
                    2 网络编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="../../engineering/network_prag/socket.html">
            
                <a href="../../engineering/network_prag/socket.html">
            
                    
                    2.1 长连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="../../engineering/network_prag/mq.html">
            
                <a href="../../engineering/network_prag/mq.html">
            
                    
                    2.2 MQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../">
            
                <a href="../">
            
                    
                    3 语言应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="node.html">
            
                <a href="node.html">
            
                    
                    3.1 Node.js
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1.1" data-path="core.html">
            
                <a href="core.html">
            
                    
                    3.1.1 原理及构成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.2" data-path="async.html">
            
                <a href="async.html">
            
                    
                    3.1.2 异步机制
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.3.1.3" data-path="important.html">
            
                <a href="important.html">
            
                    
                    3.1.3 一些核心概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.4" data-path="koa_web.html">
            
                <a href="koa_web.html">
            
                    
                    3.1.4 web应用: koa框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.5" data-path="koa.html">
            
                <a href="koa.html">
            
                    
                    3.1.5 koa源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.6" data-path="libuv.html">
            
                <a href="libuv.html">
            
                    
                    3.1.6 libuv网络库应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.7" data-path="apm.html">
            
                <a href="apm.html">
            
                    
                    3.1.7 性能调优
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.8" data-path="node_spider.html">
            
                <a href="node_spider.html">
            
                    
                    3.1.8 其他: Node爬虫
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.9" data-path="node_map_reduce.html">
            
                <a href="node_map_reduce.html">
            
                    
                    3.1.9 其他: Node编写Mapreduce
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../c/c_and_plus.html">
            
                <a href="../c/c_and_plus.html">
            
                    
                    3.2 C/C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.2.1" data-path="../c/oop.html">
            
                <a href="../c/oop.html">
            
                    
                    3.2.1 面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.2" data-path="../c/ipcs.html">
            
                <a href="../c/ipcs.html">
            
                    
                    3.2.2 进程通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.3" data-path="../c/thread.html">
            
                <a href="../c/thread.html">
            
                    
                    3.2.3 线程管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.4" data-path="../c/memory.html">
            
                <a href="../c/memory.html">
            
                    
                    3.2.4 内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.5" data-path="../c/network.html">
            
                <a href="../c/network.html">
            
                    
                    3.2.5 网络编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.6" data-path="../c/build_tool.html">
            
                <a href="../c/build_tool.html">
            
                    
                    3.2.6 构建工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.7" data-path="../c/thread_pool.html">
            
                <a href="../c/thread_pool.html">
            
                    
                    3.2.7 其他: 线程池
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../engineering/ci_deplopment/">
            
                <a href="../../engineering/ci_deplopment/">
            
                    
                    三 搭建部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../engineering/ci_deplopment/test.html">
            
                <a href="../../engineering/ci_deplopment/test.html">
            
                    
                    3.1 测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../../engineering/ci_deplopment/test/unit_testing.html">
            
                <a href="../../engineering/ci_deplopment/test/unit_testing.html">
            
                    
                    3.1.1 单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../../engineering/ci_deplopment/test/stress_testing.html">
            
                <a href="../../engineering/ci_deplopment/test/stress_testing.html">
            
                    
                    3.1.2 压力测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../engineering/ci_deplopment/ci_readme.html">
            
                <a href="../../engineering/ci_deplopment/ci_readme.html">
            
                    
                    3.2 集成
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../../engineering/ci_deplopment/ci/gitlab_ci.html">
            
                <a href="../../engineering/ci_deplopment/ci/gitlab_ci.html">
            
                    
                    3.2.1 GitLab CI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="../../engineering/ci_deplopment/ci/spinnaker.html">
            
                <a href="../../engineering/ci_deplopment/ci/spinnaker.html">
            
                    
                    3.2.2 Spinnaker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../engineering/ci_deplopment/build.html">
            
                <a href="../../engineering/ci_deplopment/build.html">
            
                    
                    3.3 部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1" data-path="../../engineering/ci_deplopment/k8s/k8s.html">
            
                <a href="../../engineering/ci_deplopment/k8s/k8s.html">
            
                    
                    3.3.1 k8s
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="../../engineering/ci_deplopment/rancher/rancher.html">
            
                <a href="../../engineering/ci_deplopment/rancher/rancher.html">
            
                    
                    3.3.2 rancher
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.3" data-path="../../engineering/ci_deplopment/swarm/swarm.html">
            
                <a href="../../engineering/ci_deplopment/swarm/swarm.html">
            
                    
                    3.3.3 swarm
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../engineering/ci_deplopment/maintenance.html">
            
                <a href="../../engineering/ci_deplopment/maintenance.html">
            
                    
                    3.4 监控
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="../../engineering/ci_deplopment/monitor.html">
            
                <a href="../../engineering/ci_deplopment/monitor.html">
            
                    
                    3.4.1 容器监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2" data-path="../../engineering/ci_deplopment/trace.html">
            
                <a href="../../engineering/ci_deplopment/trace.html">
            
                    
                    3.4.2 系统监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3" data-path="../../engineering/ci_deplopment/app1.md">
            
                <span>
            
                    
                    3.4.2 应用监控
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../engineering/ha/ha.html">
            
                <a href="../../engineering/ha/ha.html">
            
                    
                    3.5 高可用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.5.1" data-path="../../engineering/ha/client.html">
            
                <a href="../../engineering/ha/client.html">
            
                    
                    3.5.1 接入层高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.2" data-path="../../engineering/ha/service.html">
            
                <a href="../../engineering/ha/service.html">
            
                    
                    3.5.2 服务层高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.3" data-path="../../engineering/ha/share.html">
            
                <a href="../../engineering/ha/share.html">
            
                    
                    3.5.3 存储层高可用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../../engineering/ci_deplopment/hc/hc.html">
            
                <a href="../../engineering/ci_deplopment/hc/hc.html">
            
                    
                    3.6 高并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.6.1" data-path="../../engineering/ci_deplopment/hc/dns.html">
            
                <a href="../../engineering/ci_deplopment/hc/dns.html">
            
                    
                    3.6.1 基于DNS的负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6.2" data-path="../../engineering/ci_deplopment/hc/lvs.html">
            
                <a href="../../engineering/ci_deplopment/hc/lvs.html">
            
                    
                    3.6.2 基于Lvs的负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6.3" data-path="../../engineering/ci_deplopment/hc/haproxy.html">
            
                <a href="../../engineering/ci_deplopment/hc/haproxy.html">
            
                    
                    3.6.3 基于haproxy的负载均衡
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    四 架构模式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    1 微服务架构设计与实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="../java/spring-cloud.html">
            
                <a href="../java/spring-cloud.html">
            
                    
                    1.1 微服务概况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="../java/spring-eureka.html">
            
                <a href="../java/spring-eureka.html">
            
                    
                    1.2 服务注册及发现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="../java/spring-feign.html">
            
                <a href="../java/spring-feign.html">
            
                    
                    1.3 服务调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.4" data-path="../java/spring-zuul.html">
            
                <a href="../java/spring-zuul.html">
            
                    
                    1.4 网关及负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.5" data-path="../java/spring-hystrix.html">
            
                <a href="../java/spring-hystrix.html">
            
                    
                    1.5 熔断、限流、扩缩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.6" data-path="../java/spring-config.html">
            
                <a href="../java/spring-config.html">
            
                    
                    1.6 云配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.7" data-path="../java/zipkin-tracing.html">
            
                <a href="../java/zipkin-tracing.html">
            
                    
                    1.7 分布式链路追踪
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.8" data-path="../java/swagger.html">
            
                <a href="../java/swagger.html">
            
                    
                    1.8 接口文档管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../domain/">
            
                <a href="../../domain/">
            
                    
                    2 领域驱动模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="../../domain/domain.html">
            
                <a href="../../domain/domain.html">
            
                    
                    2.1 领域--Domain
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="../../domain/entity.md">
            
                <span>
            
                    
                    2.2 领域实体--Entity
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.3" data-path="../../domain/object.html">
            
                <a href="../../domain/object.html">
            
                    
                    2.3 值对象--Value Object
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.4" data-path="../../domain/aggregate.html">
            
                <a href="../../domain/aggregate.html">
            
                    
                    2.4 聚合--Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.5" data-path="../../domain/service.html">
            
                <a href="../../domain/service.html">
            
                    
                    2.5 服务--Services
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.6" data-path="../../domain/event.html">
            
                <a href="../../domain/event.html">
            
                    
                    2.6 领域事件--Event
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.7" data-path="../../domain/framework.html">
            
                <a href="../../domain/framework.html">
            
                    
                    2.7 几种常见的DDD架构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.3" >
            
                <span>
            
                    
                    3 架构技术的演化与趋势
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.3.1" >
            
                <span>
            
                    
                    3.1 架构技术的发展历史及现状
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.2" >
            
                <span>
            
                    
                    3.2 Serverless无服务架构概念
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.3" >
            
                <span>
            
                    
                    3.3 ServerMesh网格服务概念
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    五 其他
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../story/talk.html">
            
                <a href="../../story/talk.html">
            
                    
                    5.1 小伙子,放松!
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >3.1.3 一些核心概念</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <!-- ### 一、模块加载

Node.js模块类型分为如下几种:

```js
/** app.js
 *1、核心(原生)模块，如event、fs、http
 *2、第三方模块，request、bluebird
 *3、本地js模块，如项目中自定义的./util模块等
 *4、本地C++模块，通过node-nyp安装的模块
 */
const fs = require('js')
const request = require('request')

const util = require('./util')
const cPlusDemo = require('../../build/Release/demo')

console.log('modules have been band or loaded。。。')
```
&nbsp;&nbsp;&nbsp;&nbsp;当执行node app.js，node模块加载源码如下: -->
<hr>
<h3 id="&#x4E8C;&#x3001;&#x539F;&#x578B;&#x4E0E;&#x7EE7;&#x627F;">&#x4E8C;&#x3001;&#x539F;&#x578B;&#x4E0E;&#x7EE7;&#x627F;</h3>
<ul>
<li>2.1 &#x57FA;&#x4E8E;&#x539F;&#x578B;&#x7684;&#x7EE7;&#x627F;</li>
</ul>
<pre><code class="lang-js"><span class="hljs-comment">/*
 * Node.js&#x51E0;&#x79CD;&#x7EE7;&#x627F;&#x65B9;&#x5F0F;
 */</span>

<span class="hljs-comment">/* &#x4E00; class &#x7EE7;&#x627F; */</span>
<span class="hljs-keyword">const</span> util = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;util&apos;</span>)

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ClassA</span> </span>{
  <span class="hljs-keyword">constructor</span>(name) {
    <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;ClassA&apos;</span>
  }

  printName() {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
  }

  commonPrint() {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${this.name}</span>:&#x8FD9;&#x662F;class&#x65B9;&#x5F0F;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x65B9;&#x6CD5;`</span>)
  }

}

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ClassB</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ClassA</span> </span>{
  <span class="hljs-keyword">constructor</span>(name) {
    <span class="hljs-keyword">super</span>()
    <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;ClassB&apos;</span>
  }
}

<span class="hljs-keyword">const</span> objB = <span class="hljs-keyword">new</span> ClassB(<span class="hljs-string">&apos;ClassB&apos;</span>)
objB.printName()
objB.commonPrint()
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x53EA;&#x80FD;&#x5355;&#x7EE7;&#x627F;
2&#x3001;&#x7236;&#x7C7B;&#x5C5E;&#x6027;&#x65B9;&#x6CD5;&#x88AB;&#x5171;&#x4EAB;&#xFF0C;&#x4E14;&#x53EF;&#x4EE5;&#x5411;&#x7236;&#x7C7B;&#x6784;&#x9020;&#x51FD;&#x6570;&#x4F20;&#x53C2;
</code></pre><pre><code class="lang-js">
<span class="hljs-comment">/* &#x4E8C; util.inherits */</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">InheritsA</span> (<span class="hljs-params">name</span>)</span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;InheritsA&apos;</span>
  <span class="hljs-keyword">this</span>.printName = () =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
  }
}

InheritsA.prototype.commonPrint = () =&gt; {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${this.name}</span>:&#x8FD9;&#x662F;&#x57FA;&#x4E8E;&#x539F;&#x578B;&#x7684;&#x4E00;&#x4E2A;&#x516C;&#x7528;&#x65B9;&#x6CD5;`</span>)
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">InheritsB</span> (<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;InheritsB&apos;</span>
}


util.inherits(InheritsB, InheritsA)

<span class="hljs-keyword">const</span> inheritsB = <span class="hljs-keyword">new</span> InheritsB(<span class="hljs-string">&apos;InheritsB&apos;</span>)
<span class="hljs-comment">// inheritsB.printName() // error</span>
inheritsB.commonPrint()


<span class="hljs-comment">/* inherits &#x6E90;&#x7801; */</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">inherits</span>(<span class="hljs-params">ctor, superCtor</span>) </span>{

  <span class="hljs-keyword">if</span> (ctor === <span class="hljs-literal">undefined</span> || ctor === <span class="hljs-literal">null</span>)
    <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> ERR_INVALID_ARG_TYPE(<span class="hljs-string">&apos;ctor&apos;</span>, <span class="hljs-string">&apos;Function&apos;</span>, ctor);

  <span class="hljs-keyword">if</span> (superCtor === <span class="hljs-literal">undefined</span> || superCtor === <span class="hljs-literal">null</span>)
    <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> ERR_INVALID_ARG_TYPE(<span class="hljs-string">&apos;superCtor&apos;</span>, <span class="hljs-string">&apos;Function&apos;</span>, superCtor);

  <span class="hljs-keyword">if</span> (superCtor.prototype === <span class="hljs-literal">undefined</span>) {
    <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> ERR_INVALID_ARG_TYPE(<span class="hljs-string">&apos;superCtor.prototype&apos;</span>,
                                   <span class="hljs-string">&apos;Function&apos;</span>, superCtor.prototype);
  }
  ctor.super_ = superCtor;
  <span class="hljs-built_in">Object</span>.setPrototypeOf(ctor.prototype, superCtor.prototype);
}
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x53EA;&#x80FD;&#x5355;&#x7EE7;&#x627F;, &#x4E14;&#x53EA;&#x7EE7;&#x627F;&#x539F;&#x578B;&#x65B9;&#x6CD5;
2&#x3001;util.inherits&#x5B9E;&#x73B0;&#x7EE7;&#x627F;, &#x5B9E;&#x5219;&#x4E3A;&#x901A;&#x8FC7;Object.setPrototypeOf()&#x4E3A;&#x73B0;&#x6709;&#x5BF9;&#x8C61;&#x8BBE;&#x7F6E;&#x539F;&#x578B;
</code></pre><pre><code class="lang-js">
 <span class="hljs-comment">/* &#x4E09; Object.create()&#x7EE7;&#x627F; */</span>

<span class="hljs-keyword">const</span> ObjectA = <span class="hljs-built_in">Object</span>.create(<span class="hljs-literal">null</span>, { name: { value: <span class="hljs-string">&apos;hello world&apos;</span>} })
<span class="hljs-built_in">console</span>.log(ObjectA.name)
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x53EA;&#x80FD;&#x5355;&#x7EE7;&#x627F;&#xFF0C;&#x53EF;&#x7528;&#x4E8E;&#x51FD;&#x6570;&#x4E0E;&#x5BF9;&#x8C61;&#x7EE7;&#x627F;&#xFF0C;&#x8FD4;&#x56DE;&#x5BF9;&#x5E94;&#x7684;&#x5B9E;&#x4F8B;
2&#x3001;Object.create(prototype, constructor)&#x4E0E;util.inherits&#x7C7B;&#x4F3C;&#xFF0C;&#x4F46;Object.create&#x63A5;&#x53D7;&#x53C2;&#x6570;&#x5206;&#x522B;&#x662F;&#x539F;&#x578B;&#x548C;&#x6784;&#x9020;&#x51FD;&#x6570;
</code></pre><pre><code class="lang-js"><span class="hljs-comment">/* &#x56DB; &#x539F;&#x578B;&#x94FE;&#x7EE7;&#x627F; */</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">ProtoA</span>(<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;ProtoA&apos;</span>
  <span class="hljs-keyword">this</span>.getName = () =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
  }
}

ProtoA.prototype.commonPrint = () =&gt; {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${this.name}</span>:&#x8FD9;&#x662F;&#x539F;&#x578B;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x65B9;&#x6CD5;`</span>)
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">ProtoB</span>(<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;ProtoB&apos;</span>
}

<span class="hljs-comment">// ProtoB.prototype = new ProtoA()    // &#x65B9;&#x5F0F;1</span>
<span class="hljs-comment">// ProtoB.prototype = ProtoA.prototype // &#x65B9;&#x5F0F;2</span>
ProtoB.prototype = (<span class="hljs-keyword">new</span> ProtoA).__proto__ <span class="hljs-comment">// &#x65B9;&#x5F0F;3</span>

<span class="hljs-keyword">const</span> protoB = <span class="hljs-keyword">new</span> ProtoB(<span class="hljs-string">&apos;ProtoB&apos;</span>)
<span class="hljs-comment">// protoB.getName() // error</span>
protoB.commonPrint()
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x53EA;&#x80FD;&#x5355;&#x7EE7;&#x627F;&#xFF0C;&#x53EF;&#x4EE5;&#x5982;&#x4E0A;&#x6709;&#x591A;&#x79CD;&#x5199;&#x6CD5;
2&#x3001;&#x65E0;&#x6CD5;&#x5411;&#x7236;&#x7C7B;&#x6784;&#x9020;&#x51FD;&#x6570;&#x4F20;&#x53C2;
</code></pre><pre><code class="lang-js"><span class="hljs-comment">/* &#x4E94; &#x6784;&#x9020;&#x7EE7;&#x627F; */</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">CtrA</span>(<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;CtrA&apos;</span>
  <span class="hljs-keyword">this</span>.getName = () =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
  }
}

CtrA.prototype.commonPrint = () =&gt; {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${this.name}</span>:&#x8FD9;&#x662F;&#x6784;&#x9020;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;`</span>)
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">CtrB</span>(<span class="hljs-params">name</span>) </span>{
  CtrA.call(<span class="hljs-keyword">this</span>, name)
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;CtrB&apos;</span>
}

<span class="hljs-keyword">const</span> ctrB = <span class="hljs-keyword">new</span> CtrB(<span class="hljs-string">&apos;CtrB&apos;</span>)
ctrB.getName()
<span class="hljs-comment">// ctrB.commonPrint() // error</span>
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x591A;&#x7EE7;&#x627F;(call&#x591A;&#x6B21;)&#xFF0C;
2&#x3001;&#x5B9E;&#x4F8B;&#x662F;&#x5B50;&#x7C7B;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x662F;&#x4F46;&#x53EA;&#x80FD;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027;&#x65B9;&#x6CD5;&#xFF0C;&#x4E0D;&#x80FD;&#x7EE7;&#x627F;&#x539F;&#x578B;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;
</code></pre><pre><code class="lang-js"><span class="hljs-comment">/* &#x516D; &#x62F7;&#x8D1D;&#x7EE7;&#x627F; */</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">_extend</span>(<span class="hljs-params">target, source</span>) </span>{
  <span class="hljs-keyword">if</span> (source === <span class="hljs-literal">null</span> || <span class="hljs-keyword">typeof</span> source !== <span class="hljs-string">&apos;object&apos;</span>) <span class="hljs-keyword">return</span> target;

  <span class="hljs-keyword">const</span> keys = <span class="hljs-built_in">Object</span>.keys(source);

  <span class="hljs-keyword">let</span> i = keys.length;
  <span class="hljs-keyword">while</span> (i--) {
    target.prototype[keys[i]] = source[keys[i]];
  }
  <span class="hljs-keyword">return</span> target;
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">CopyA</span>(<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;CopyA&apos;</span>
  <span class="hljs-keyword">this</span>.getName = () =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
  }
}

CopyA.prototype.commonPrint = () =&gt; {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${this.name}</span>:&#x8FD9;&#x662F;&#x62F7;&#x8D1D;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;`</span>)
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">CopyB</span>(<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;CopyB&apos;</span>
  _extend(CopyB, <span class="hljs-keyword">new</span> CopyA(<span class="hljs-string">&apos;CopyA&apos;</span>))
}

<span class="hljs-keyword">const</span> copyB = <span class="hljs-keyword">new</span> CopyB(<span class="hljs-string">&apos;CopyB&apos;</span>)
<span class="hljs-comment">// copyB.commonPrint() // error</span>
copyB.getName()
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x652F;&#x6301;&#x591A;&#x7EE7;&#x627F;(_extend&#x591A;&#x6B21;), &#x53EA;&#x80FD;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x5B9E;&#x4F8B;&#x65B9;&#x6CD5;&#x5C5E;&#x6027;&#xFF0C;&#x4E0D;&#x80FD;&#x7EE7;&#x627F;&#x539F;&#x578B;&#x65B9;&#x6CD5;&#x5C5E;&#x6027;
2&#x3001;&#x5185;&#x5B58;&#x5360;&#x7528;&#x9AD8;&#x4E14;&#x65E0;&#x6CD5;&#x7EE7;&#x627F;&#x4E0D;&#x53EF;&#x679A;&#x4E3E;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#xFF0C;&#x5982;&#x539F;&#x578B;&#x5C5E;&#x6027;&#x65B9;&#x6CD5;
</code></pre><pre><code class="lang-js"> <span class="hljs-comment">/* &#x4E03; &#x7EC4;&#x5408;&#x7EE7;&#x627F; */</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">CombA</span>(<span class="hljs-params">name</span>) </span>{
  <span class="hljs-keyword">this</span>.name = name || <span class="hljs-string">&apos;CombA&apos;</span>
  <span class="hljs-keyword">this</span>.getName = () =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
  }
}

CombA.prototype.commonPrint = () =&gt; {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${this.name}</span>:&#x8FD9;&#x662F;&#x7EC4;&#x5408;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;`</span>)
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">CombB</span>(<span class="hljs-params">name</span>) </span>{
  CombA.call(<span class="hljs-keyword">this</span>)
}

CombB.prototype = <span class="hljs-keyword">new</span> CombA()

<span class="hljs-keyword">const</span> combB = <span class="hljs-keyword">new</span> CombB(<span class="hljs-string">&apos;CombB&apos;</span>)
combB.getName()
combB.commonPrint()
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;</li>
</ul>
<pre><code>1&#x3001;&#x5355;&#x7EE7;&#x627F;&#x4E14;&#x6784;&#x9020;&#x51FD;&#x6570;&#x53EF;&#x4EE5;&#x4F20;&#x53C2;
2&#x3001;&#x53EF;&#x4EE5;&#x7EE7;&#x627F;&#x539F;&#x578B;&#x3001;&#x5B9E;&#x4F8B;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;
</code></pre><ul>
<li>&#x6240;&#x6709;&#x7ED3;&#x679C;&#x6253;&#x5370;</li>
</ul>
<pre><code class="lang-text">ClassB
ClassB:&#x8FD9;&#x662F;class&#x65B9;&#x5F0F;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x65B9;&#x6CD5;
undefined:&#x8FD9;&#x662F;&#x57FA;&#x4E8E;&#x539F;&#x578B;&#x7684;&#x4E00;&#x4E2A;&#x516C;&#x7528;&#x65B9;&#x6CD5;
hello world
undefined:&#x8FD9;&#x662F;&#x539F;&#x578B;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x65B9;&#x6CD5;
CtrB
CopyA
CombA
undefined:&#x8FD9;&#x662F;&#x7EC4;&#x5408;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x7684;&#x65B9;&#x6CD5;
</code></pre>
<hr>
<ul>
<li>2.2 &#x539F;&#x578B;&#x7684;&#x4E00;&#x4E9B;&#x6982;&#x5FF5;</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-comment">/**
 * Prototype&#x3001;__proto__&#x3001;Constructor&#x3001;Object&#x3001;Function
 *
 */</span>


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Demo</span> </span>{

  <span class="hljs-keyword">constructor</span>(coffee) {
    <span class="hljs-keyword">this</span>.coffee = coffee || <span class="hljs-string">&apos;coffee&apos;</span>
  }

  getCoffee() {
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.coffee
  }

}


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DemoEx</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Demo</span> </span>{
  <span class="hljs-keyword">constructor</span>(coffee) {
    <span class="hljs-keyword">super</span>(coffee);
    <span class="hljs-keyword">this</span>.coffee = coffee || <span class="hljs-string">&apos;coffeeEx&apos;</span>  
  } 

  getMyCoffee() {
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.coffee
  } 

}


<span class="hljs-keyword">const</span> demo = <span class="hljs-keyword">new</span> Demo()
<span class="hljs-keyword">const</span> demoEx = <span class="hljs-keyword">new</span> DemoEx()

<span class="hljs-comment">// Constructor</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Demo.prototype.contructor === DemoEx.prototype.contructor:&apos;</span>, 
  Demo.prototype.constructor === DemoEx.prototype.constructor)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Demo.prototype.contructor === Demo&apos;</span>, 
  Demo.prototype.constructor === Demo, <span class="hljs-string">&apos;\n&apos;</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Demo.prototype.getCoffee === DemoEx.prototype.getCoffee:&apos;</span>, 
  Demo.prototype.getCoffee === DemoEx.prototype.getCoffee)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;demo.__proto__.constructor === Demo:&apos;</span>, 
  demo.__proto__.constructor === Demo, <span class="hljs-string">&apos;\n&apos;</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;demo.__proto__.contructor === Demo.prototype.constructor:&apos;</span>, 
  demo.__proto__.constructor === Demo.prototype.constructor, <span class="hljs-string">&apos;\n&apos;</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;demoEx.__proto__.contructor === Demo.prototype.contructor:&apos;</span>, 
  demoEx.__proto__.constructor === Demo.prototype.constructor)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;demo.__proto__.getCoffee === demoEx.__proto__.getCoffee&apos;</span>, 
  demo.__proto__.getCoffee === demoEx.__proto__.getCoffee, <span class="hljs-string">&apos;\n&apos;</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;demo.__proto__.getMyCoffee === demoEx.__proto__.getMyCoffee&apos;</span>, 
  demo.__proto__.getMyCoffee === demoEx.__proto__.getMyCoffee)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;demo.__proto__.getCoffee === Demo.prototype.getCoffee&apos;</span>, 
  demo.__proto__.getCoffee === Demo.prototype.getCoffee)


<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object:  &apos;</span>, <span class="hljs-built_in">Object</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object.prototype:  &apos;</span>, <span class="hljs-built_in">Object</span>.prototype)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object.__proto__:  &apos;</span>, <span class="hljs-built_in">Object</span>.__proto__)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object.prototype.prototype:  &apos;</span>, <span class="hljs-built_in">Object</span>.prototype.prototype)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object.prototype.__proto__:  &apos;</span>, <span class="hljs-built_in">Object</span>.prototype.__proto__)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object.__proto__.prototype:  &apos;</span>, <span class="hljs-built_in">Object</span>.__proto__.prototype, <span class="hljs-string">&apos;\n&apos;</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Function:  &apos;</span>, <span class="hljs-built_in">Function</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Function.prototype:  &apos;</span>, <span class="hljs-built_in">Function</span>.prototype)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Function.__proto__:  &apos;</span>, <span class="hljs-built_in">Function</span>.__proto__)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Function.prototype.prototype:  &apos;</span>, <span class="hljs-built_in">Function</span>.prototype.prototype)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Function.prototype.__proto__:  &apos;</span>, <span class="hljs-built_in">Function</span>.prototype.__proto__)
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Function.__proto__.prototype:  &apos;</span>, <span class="hljs-built_in">Function</span>.__proto__.prototype, <span class="hljs-string">&apos;\n&apos;</span>)


<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;Object.constructor === Function: &apos;</span>, <span class="hljs-built_in">Object</span>.constructor === <span class="hljs-built_in">Function</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Object</span> <span class="hljs-keyword">instanceof</span> <span class="hljs-built_in">Function</span>)
<span class="hljs-built_in">console</span>.log(<span class="hljs-built_in">Function</span> <span class="hljs-keyword">instanceof</span> <span class="hljs-built_in">Object</span>)
</code></pre>
<pre><code class="lang-js"><span class="hljs-comment">// &#x4ECE;&#x6253;&#x5370;&#x7ED3;&#x679C;&#x53EF;&#x4EE5;&#x770B;&#x5230;</span>
<span class="hljs-number">1</span>&#x3001;&#x6240;&#x6709;&#x5BF9;&#x8C61;&#x53CA;&#x7C7B;&#x57FA;&#x4E8E;:__proto__&#x5B9E;&#x73B0;&#x539F;&#x578B;&#x7EE7;&#x627F;
<span class="hljs-number">2</span>&#x3001;<span class="hljs-built_in">Object</span>&#x53CA;<span class="hljs-built_in">Function</span>&#x5904;&#x4E8E;&#x539F;&#x578B;&#x94FE;&#x9876;&#x7AEF;, &#x901A;&#x8FC7;<span class="hljs-built_in">Function</span>&#x65B9;&#x6CD5;&#x521D;&#x59CB;&#x5316;&#x5BF9;&#x8C61;
<span class="hljs-number">3</span>&#x3001;__proto__&#x5F15;&#x7528;prototype
<span class="hljs-number">4</span>&#x3001;<span class="hljs-keyword">constructor</span>&#x6307;&#x5411;&#x7C7B;&#x672C;&#x8EAB;
</code></pre>
<hr>
<h3 id="&#x4E09;&#x3001;&#x5176;&#x4ED6;">&#x4E09;&#x3001;&#x5176;&#x4ED6;</h3>
<ul>
<li>3.1 &#x95ED;&#x5305;</li>
</ul>
<p>&#x501F;&#x7528;&#x5916;&#x5C42;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x5C5E;&#x6027;&#x5B9E;&#x73B0;&#x5185;&#x5C42;&#x51FD;&#x6570;&#x7684;&#x65B9;&#x6CD5;&#x5C5E;&#x6027;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> clojue = (m) =&gt; {
  <span class="hljs-keyword">return</span> (n) =&gt; {
    <span class="hljs-keyword">return</span> m * n  
  }  
} 

<span class="hljs-keyword">const</span> clo_1 = clojue(<span class="hljs-number">1</span>)
<span class="hljs-keyword">const</span> clo_2 = clojue(<span class="hljs-number">2</span>)

<span class="hljs-built_in">console</span>.log(clo_1(<span class="hljs-number">3</span>))
<span class="hljs-built_in">console</span>.log(clo_2(<span class="hljs-number">3</span>))
</code></pre>
<ul>
<li>3.2 &#x4F5C;&#x7528;&#x57DF;</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-comment">// ES6 &#x65E0;&#x53D8;&#x91CF;&#x63D0;&#x5347; let&#x58F0;&#x660E;&#x9ED8;&#x8BA4;&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;</span>

<span class="hljs-keyword">const</span> out_1 = <span class="hljs-string">&apos;out_1&apos;</span>
<span class="hljs-keyword">const</span> out_2 = <span class="hljs-string">&apos;out_2&apos;</span>

<span class="hljs-keyword">const</span> outFnOne = (out) =&gt; {
  <span class="hljs-keyword">return</span> out_1  
}

<span class="hljs-keyword">const</span> outFnTwo = (out) =&gt; {
  <span class="hljs-keyword">const</span> out_2 = <span class="hljs-string">&apos;in_2&apos;</span>
  <span class="hljs-keyword">return</span> out_2
}

<span class="hljs-built_in">console</span>.log(outFnOne())
<span class="hljs-built_in">console</span>.log(outFnTwo())

<span class="hljs-keyword">const</span> fn = (flag) =&gt; {
  <span class="hljs-keyword">if</span>(flag) {
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getChat</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;A&apos;</span> }  
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getChat</span>(<span class="hljs-params"></span>) </span>{ <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;B&apos;</span> }  
  }

  <span class="hljs-keyword">return</span> getChat()
}

<span class="hljs-built_in">console</span>.log(fn(<span class="hljs-literal">true</span>))
<span class="hljs-built_in">console</span>.log(fn(<span class="hljs-literal">false</span>))
</code></pre>
<ul>
<li>3.3 &#x4E0A;&#x4E0B;&#x6587;</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>)

<span class="hljs-keyword">const</span> ObjectOne = {
  name: <span class="hljs-string">&apos;joseph&apos;</span>,
  fn: () =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>)  
  },
}

ObjectOne.fn()

<span class="hljs-keyword">const</span> fnOne = () =&gt; {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>)

  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getThis</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>)  
  } 

  getThis()

}

fnOne()
</code></pre>
<ul>
<li>3.4 JS&#x5E38;&#x89C1;&#x5751;</li>
</ul>
<h4 id="341-&#x4F5C;&#x7528;&#x57DF;">3.4.1 &#x4F5C;&#x7528;&#x57DF;</h4>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> setTimeoutDemo = (arr) =&gt; {
  <span class="hljs-keyword">let</span> func = arr || [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]

  <span class="hljs-keyword">for</span>(<span class="hljs-keyword">var</span> i <span class="hljs-keyword">in</span> func) {<span class="hljs-comment">// var(&#x884C;&#x6570;&#x4F5C;&#x7528;&#x57DF;) let(&#x5757;&#x4F5C;&#x7528;&#x57DF;&#x65E0;&#x53D8;&#x91CF;&#x63D0;&#x5347;)</span>
    setTimeout(() =&gt; {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`time 1 <span class="hljs-subst">${func[i]}</span>`</span>)
    }, <span class="hljs-number">0</span>)

    setTimeout(() =&gt; {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`time 2 <span class="hljs-subst">${func[i]}</span>`</span>)
    }, <span class="hljs-number">0</span>)

    <span class="hljs-built_in">console</span>.log(i)
  }

}
</code></pre>
<ul>
<li>var&#x58F0;&#x660E;&#x6267;&#x884C;&#x7ED3;&#x679C;<pre><code class="lang-text">0
1
2
time 1 3
time 2 3
time 1 3
time 2 3
time 1 3
time 2 3
</code></pre>
</li>
</ul>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> setTimeoutDemo = (arr) =&gt; {
  <span class="hljs-keyword">let</span> func = arr || [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]

  <span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i <span class="hljs-keyword">in</span> func) {<span class="hljs-comment">// var(&#x884C;&#x6570;&#x4F5C;&#x7528;&#x57DF;) let(&#x5757;&#x4F5C;&#x7528;&#x57DF;&#x65E0;&#x53D8;&#x91CF;&#x63D0;&#x5347;)</span>
    setTimeout(() =&gt; {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`time 1 <span class="hljs-subst">${func[i]}</span>`</span>)
    }, <span class="hljs-number">0</span>)

    setTimeout(() =&gt; {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`time 2 <span class="hljs-subst">${func[i]}</span>`</span>)
    }, <span class="hljs-number">0</span>)

    <span class="hljs-built_in">console</span>.log(i)
  }

}
</code></pre>
<ul>
<li><p>let&#x58F0;&#x660E;&#x6267;&#x884C;&#x7ED3;&#x679C;</p>
<pre><code class="lang-text">0
1
2
time 1 1
time 2 1
time 1 2
time 2 2
time 1 3
time 2 3
</code></pre>
</li>
<li><p>&#x603B;&#x7ED3;</p>
</li>
</ul>
<pre><code class="lang-text">1&#x3001;setTimeout&#x51FD;&#x6570;&#x672C;&#x8EAB;&#x4F1A;&#x653E;&#x5230;&#x5B9A;&#x65F6;&#x5668;&#x961F;&#x5217;&#x4E2D;&#x6267;&#x884C;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5B9A;&#x65F6;&#x5668;1&#x3001;2&#x6309;&#x987A;&#x5E8F;&#x6267;&#x884C;
2&#x3001;let&#x548C;var&#x58F0;&#x660E;&#x7684;&#x6267;&#x884C;&#x7ED3;&#x679C;&#x4E0D;&#x540C;&#xFF0C;&#x56E0;&#x4E3A;let&#x58F0;&#x660E;&#x662F;&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;&#xFF0C;&#x800C;var&#x58F0;&#x660E;&#x662F;&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#xFF0C;&#x540E;&#x503C;&#x4F1A;&#x5C06;&#x524D;&#x503C;&#x8986;&#x76D6;&#xFF0C;for&#x5FAA;&#x73AF;&#x672C;&#x8EAB;&#x662F;&#x540C;&#x6B65;&#x6267;&#x884C;&#xFF0C;&#x5F53;&#x5FAA;&#x73AF;&#x7ED3;&#x675F;&#x540E;&#xFF0C;&#x5F00;&#x59CB;&#x6267;&#x884C;&#x5B9A;&#x65F6;&#x5668;&#xFF0C;&#x6B64;&#x65F6;var&#x58F0;&#x660E;&#x7684;&#x53D8;&#x91CF;&#x503C;&#x5DF2;&#x7ECF;&#x53D8;&#x4E3A;2&#x88AB;&#x591A;&#x6B21;&#x6267;&#x884C;
3&#x3001;ES6&#x4E2D;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x4F18;&#x5148;&#x7EA7;&#x522B; const &gt; let &gt; var
</code></pre>
<h4 id="342-&#x5982;&#x4F55;&#x5224;&#x65AD;&#x53D8;&#x91CF;&#x7C7B;&#x578B;">3.4.2 &#x5982;&#x4F55;&#x5224;&#x65AD;&#x53D8;&#x91CF;&#x7C7B;&#x578B;</h4>
<p>JS&#x516D;&#x5927;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x6709;: Number Object Boolean String Undefined Null</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> getObtType = (obj) =&gt; {
  <span class="hljs-keyword">const</span> t = <span class="hljs-built_in">Object</span>.prototype.toString.call(obj)

  <span class="hljs-keyword">return</span> t.substring(<span class="hljs-number">8</span>, t.length - <span class="hljs-number">1</span>)
}

[
  {}, 
  <span class="hljs-literal">null</span>,
  <span class="hljs-keyword">new</span> <span class="hljs-built_in">String</span>(),
  <span class="hljs-number">123</span>,
  <span class="hljs-built_in">Boolean</span>,
  <span class="hljs-literal">NaN</span>,
  <span class="hljs-built_in">Function</span>,
  <span class="hljs-built_in">Array</span>(),
  <span class="hljs-built_in">Date</span>(),
  <span class="hljs-built_in">JSON</span>,
  <span class="hljs-literal">undefined</span>
].map((item) =&gt; {
  <span class="hljs-built_in">console</span>.log(getObtType(item))
})
</code></pre>
<ul>
<li>&#x7ED3;&#x679C;&#x6253;&#x5370;</li>
</ul>
<pre><code class="lang-text">Object
Null
String
Number
Function
Number
Function
Array
String
JSON
Undefined
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;<pre><code class="lang-text">1&#x3001;Node&#x4E2D;&#x5224;&#x65AD;&#x7C7B;&#x578B;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E0A;&#x8FF0;&#x65B9;&#x6CD5;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5DE5;&#x5177;&#x5E93;util.types&#x4E2D;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x5982;util.types.isDate(new Date());  // Returns true
2&#x3001;&#x57FA;&#x672C;&#x7C7B;&#x578B;&#x90FD;&#x6709;&#x5176;&#x5305;&#x88C5;&#x7C7B;&#xFF0C;&#x5176;&#x7C7B;&#x578B;&#x7684;&#x539F;&#x578B;&#x94FE;&#x9876;&#x7AEF;&#x6307;&#x5411;Object
3&#x3001;NaN&#x4E3A;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x7C7B;&#x578B;&#xFF0C;&#x5F53;&#x88AB;&#x8F6C;&#x6362;&#x7684;&#x503C;&#x65E0;&#x6CD5;&#x8F6C;&#x4E3A;Number&#x7C7B;&#x578B;&#xFF0C;&#x4F1A;&#x53D8;&#x4E3A;NaN, NaN === NaN // return false
</code></pre>
</li>
</ul>
<h4 id="343-js&#x7CBE;&#x5EA6;&#x95EE;&#x9898;">3.4.3 JS&#x7CBE;&#x5EA6;&#x95EE;&#x9898;</h4>
<pre><code class="lang-js"><span class="hljs-number">3</span>*<span class="hljs-number">0.8</span> = <span class="hljs-number">2.4000000000000004</span>
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;<pre><code>1&#x3001;js&#x7684;&#x7C7B;&#x578B;&#x7CFB;&#x7EDF;&#x4E2D;&#xFF0C;&#x91C7;&#x7528;IEEE754&#x683C;&#x5F0F;&#x6765;&#x8868;&#x793A;&#x6570;&#x5B57;&#xFF0C;&#x4E0D;&#x533A;&#x5206;&#x6574;&#x6570;&#x548C;&#x6D6E;&#x70B9;&#x6570;&#xFF0C;js&#x4E2D;&#x7684;&#x6240;&#x6709;Number&#x7C7B;&#x578B;&#x90FD;&#x7528;&#x6D6E;&#x70B9;&#x6570;&#x503C;&#x8868;&#x793A;&#xFF0C;&#x6240;&#x4EE5;&#x7531;&#x4E8E;&#x7CBE;&#x5EA6;&#x95EE;&#x9898;&#xFF0C;&#x65E0;&#x6CD5;&#x8868;&#x793A;
2&#x3001;&#x67D0;&#x4E9B;&#x8303;&#x56F4;&#x5185;&#x7684;&#x6240;&#x6709;&#x6570;&#x503C;&#xFF0C;&#x7ECF;&#x8FC7;&#x5927;&#x91CF;&#x8FD0;&#x7B97;&#x540E;&#x504F;&#x5DEE;&#x4F1A;&#x53D8;&#x5927;&#xFF0C;&#x8FD9;&#x4E9B;&#x95EE;&#x9898;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;Mathjs&#x3001;&#x7EDF;&#x4E00;&#x7CBE;&#x5EA6;&#x7B49;&#x89E3;&#x51B3;
</code></pre></li>
</ul>
<hr>
<h3 id="&#x56DB;&#x3001;nodejs&#x9002;&#x7528;&#x573A;&#x666F;">&#x56DB;&#x3001;Node.js&#x9002;&#x7528;&#x573A;&#x666F;</h3>
<pre><code>1&#x3001;&#x524D;&#x7F6E;&#x5668;&#x3001;&#x4E2D;&#x95F4;&#x4EF6;&#x3001;&#x7F51;&#x5173;&#x805A;&#x5408;&#x3001;&#x5171;&#x4EAB;&#x4E1A;&#x52A1;&#x903B;&#x8F91;
2&#x3001;&#x5FEB;&#x901F;&#x8FED;&#x4EE3;&#xFF0C;&#x654F;&#x6377;&#x56E2;&#x961F;&#x4E2D;&#x7528;&#x4E8E;&#x4EA7;&#x54C1;&#x539F;&#x578B;&#x63A2;&#x7D22;&#x53CA;&#x5B9E;&#x73B0;
3&#x3001;&#x9AD8;&#x5E76;&#x53D1;&#x3001;&#x5F31;&#x4E1A;&#x52A1;&#x3001;&#x5F31;&#x8BA1;&#x7B97;&#x7684;&#x4E1A;&#x52A1;&#x573A;&#x666F;
</code></pre><hr>
<h3 id="&#x4E94;&#x3001;&#x5E38;&#x7528;&#x6846;&#x67B6;">&#x4E94;&#x3001;&#x5E38;&#x7528;&#x6846;&#x67B6;</h3>
<ul>
<li><a href="https://koa.bootcss.com/" target="_blank">6.1&#x3001;koa</a></li>
<li><a href="http://www.expressjs.com.cn/" target="_blank">6.2&#x3001;express</a></li>
<li><a href="https://sailsjs.com/" target="_blank">6.3&#x3001;sails</a> </li>
</ul>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x4E00;&#x84D1;&#x70DF;&#x96E8;&#x4EFB;&#x5E73;&#x751F; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x4FEE;&#x6539;&#x65F6;&#x95F4;: 
2021-04-09 11:09:02
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="async.html" class="navigation navigation-prev " aria-label="Previous page: 3.1.2 异步机制">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="koa_web.html" class="navigation navigation-next " aria-label="Next page: 3.1.4 web应用: koa框架">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.1.3 一些核心概念","level":"1.3.3.1.3","depth":4,"next":{"title":"3.1.4 web应用: koa框架","level":"1.3.3.1.4","depth":4,"path":"program/nodejs/koa_web.md","ref":"program/nodejs/koa_web.md","articles":[]},"previous":{"title":"3.1.2 异步机制","level":"1.3.3.1.2","depth":4,"path":"program/nodejs/async.md","ref":"program/nodejs/async.md","articles":[]},"dir":"ltr"},"config":{"plugins":["disqus","tree","splitter","local-video","chart","github-buttons","tbfed-pagefooter","ace","katex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 一蓑烟雨任平生","modify_label":"修改时间: ","modify_format":"YYYY-MM-DD HH:mm:ss"},"disqus":{"useIdentifier":false,"shortName":"gitbookuse"},"ace":{},"splitter":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"github-buttons":{"repo":"TIME-GATE/","types":["star","watch"],"size":"large"},"local-video":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"tree":{},"chart":{"type":"c3"}},"theme":"default","author":"zq_sdk@163.com","name":"name","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Ebook","language":"zh-hans","gitbook":"*","description":"电子书"},"file":{"path":"program/nodejs/important.md","mtime":"2021-04-09T03:09:02.251Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-04-10T12:23:44.633Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-tree/jquery.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-tree/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

